package com.game.ammo {
	import com.game.data.Data;
	import com.game.units.Enemy;
	import com.game.utils.TowerType;
	import flash.filters.GlowFilter;
	public class Bullet extends Ammo {
		private var position:Number = 0;
		public function Bullet(bulX:Number, bulY:Number, ang:Number, destination:Number, type:TowerType, upgrades:int, suggestiveDistance:int) {
			super(bulX, bulY, ang, destination, type, upgrades, suggestiveDistance);
		}
		override public function isHit(p3:Enemy):Boolean {
			if (pointToLineDistance(p3) < p3.size / 2) {
				return true;
			}
			return false;
		}
		override protected function hitAction():void {
			readyForRemoval = true;
		}
		override protected function initialSet():void {
			ammoSpeed = 2;
			_damage = (upgrades + 1) * 1;
			p1.x = -(Data.STEP / 2) * Math.cos(_angle);
			p1.y = -(Data.STEP / 2) * Math.sin(_angle);
			this.depth = 1;
			this._rect.width = 20;
			this._rect.height = 20;
			var ang:Number = (_angle * 180 / Math.PI) + 180;
			ang = ang < 0 ? 360 + ang : ang;
			this._rect.x = Math.round(ang / 15) * 20;
			this._point.x = p1.x + x - 10;
			this._point.y = p1.y + y - 10;
		}
		override public function move():void {
			position += this.ammoSpeed;
			if (position > destination) {
				readyForRemoval = true;
			}
		}
	}
}